//ACCEPTED
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>

using namespace std;

char a[3][3];
int dis1, dis2, dis3;
pair<int, int> v[3];

int process(){
	
	scanf("%s %s %s", &a[0], &a[1], &a[2] );
	
	for(int i =0;i<3;i++){
		if(!strcmp(a[i], "C"))v[i]=make_pair(3,1);
		else if(!strcmp(a[i], "C#"))v[i]=make_pair(4,2);
		else if(!strcmp(a[i], "D"))v[i]=make_pair(5,3);
		else if(!strcmp(a[i], "D#"))v[i]=make_pair(6,4);
		else if(!strcmp(a[i], "E"))v[i]=make_pair(7,5);
		else if(!strcmp(a[i], "F"))v[i]=make_pair(8,6);
		else if(!strcmp(a[i], "F#"))v[i]=make_pair(9,7);
		else if(!strcmp(a[i], "G"))v[i]=make_pair(10,8);
		else if(!strcmp(a[i], "G#"))v[i]=make_pair(11,9);
		else if(!strcmp(a[i], "A"))v[i]=make_pair(1,10);
		else if(!strcmp(a[i], "B"))v[i]=make_pair(2,11);
		else if(!strcmp(a[i], "H"))v[i]=make_pair(12,12);
	}

	sort(v, v+3);
	//for(int i=0; i<3 ; i++)printf("%d ", v[i].second);
	dis1=0;
	for(int i=v[0].second;  ; i++){
		if(i==13)i=1;
		if(i==v[1].second)break;
		dis1++;
	}
	dis3=dis1;
	dis2=0;
	for(int i=v[1].second;  ; i++){
		if(i==13)i=1;
		if(i==v[2].second)break;
		dis2++;
	}
	if(dis1==4&&dis2==3) return 1;
	else if(dis1==3&&dis2==4)return 2;
	
	dis1=dis2;
	
	dis2=0;
	for(int i=v[2].second;  ; ++i){
		if(i==13)i=1;
		if(i==v[0].second)break;
		dis2++;
	}
	if(dis1==4&&dis2==3) return 1;
	else if(dis1==3&&dis2==4)return 2;
	
	dis1=dis2;
	dis2=dis3;
	if(dis1==4&&dis2==3) return 1;
	else if(dis1==3&&dis2==4)return 2;

	
	return 0;
}
int main(){
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	scanf("%s %s %s", &a[0], &a[1], &a[2] );
	int r=process();
	if(r==1) printf("major");
	else if(r==2)printf("minor");
	else printf("strange");
	
	return 0;
}

